/**
 * 
 */
package com.demo2do.fms.admin.visitor;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.demo2do.core.utils.Alias;
import com.demo2do.fms.entity.supplier.common.AuditStatus;
import org.springframework.cache.annotation.Cacheable;

import com.demo2do.core.utils.EnumUtils;
import com.demo2do.core.visitor.AbstractObjectRoot;
import com.demo2do.fms.admin.visitor.impl.ConfigContextVisitor;
import com.demo2do.fms.admin.visitor.impl.PersistentVisitor;
import com.demo2do.fms.admin.visitor.impl.SecureVisitor;
import com.demo2do.fms.admin.visitor.impl.SelectionVisitor;



/**
 * @author Wilson
 * 
 */
public class ApplicationObjectRoot extends AbstractObjectRoot {

    private PersistentVisitor persistentVisitor;
    
    private SecureVisitor secureVisitor;
    
    private SelectionVisitor selectionVisitor;
    
    private ConfigContextVisitor configContextVisitor;
    
    private String entityPackage;

    /**
     * @param persistentVisitor the persistentVisitor to set
     */
    public void setPersistentVisitor(PersistentVisitor persistentVisitor) {
        this.persistentVisitor = persistentVisitor;
    }
    
    /**
     * @param secureVisitor the secureVisitor to set
     */
    public void setSecureVisitor(SecureVisitor secureVisitor) {
        this.secureVisitor = secureVisitor;
    }
    
    /**
     * @param selectionVisitor the selectionVisitor to set
     */
    public void setSelectionVisitor(SelectionVisitor selectionVisitor) {
        this.selectionVisitor = selectionVisitor;
    }
    
    /**
     * 
     * @param entityPackage
     */
    public void setEntityPackage(String entityPackage) {
        this.entityPackage = entityPackage;
    }
    
    /**
     * 
     * @param configContextVisitor
     */
    public void setConfigContextVisitor(ConfigContextVisitor configContextVisitor) {
        this.configContextVisitor = configContextVisitor;
    }
    
    /**
     * Get persist namespace
     * 
     * @return the persistentVisitor
     */
    public PersistentVisitor getPersist() {
        return persistentVisitor;
    }
    
    /**
     * Get secure namespace
     * 
     * @return the secureVisitor
     */
    public SecureVisitor getSecure() {
        return this.secureVisitor;
    }
    
    /**
     * Get selection namespace
     * 
     * @return
     */
    public SelectionVisitor getSelection() {
        return this.selectionVisitor;
    }
    
    /**
     * Get all the enums
     * 
     * @return
     */
    @SuppressWarnings("rawtypes")
    @Cacheable("enums")
    public Map<String, Enum[]> getEnums() {
        return EnumUtils.scan(entityPackage);
    }
    
    /**
     * Get config namespace
     * 
     * @return
     */
    public ConfigContextVisitor getConfig() {
        return this.configContextVisitor;
    }
}

